function showAll(){
    var username = document.getElementById("userName")
    var touxiang = document.querySelector(".touxiang")
    if(!(localStorage.getItem("username"))){
      touxiang.src = "images/tou2.jpeg"
      username.innerHTML="未登录"
    }else{
      touxiang.src="images/tou1.jpg"
      username.innerHTML=`${localStorage.getItem("username")}`
    }
}
var xiala = document.querySelector(".dropdown-menu")
var btnxiala = document.querySelector(".xiaLa")
btnxiala.addEventListener("click",function(){
    xiala.classList.toggle("jihuo")
  })
  var geren =  document.querySelector(".div1")
geren.addEventListener("click",function(){
  if(!(localStorage.getItem("username"))){
    alert("请先登录")
    location.href="login.html"
  }else{
    location.href="geren.html"
  }
})
window.onload=showAll